<?php
/**
 * Created by PhpStorm.
 * User: huqi
 * Date: 2017/3/25
 * Time: 18:54
 */

namespace App\Services;


use Illuminate\Http\Request;

class Ticai
{
    public static function getUrl($tag,$query = []){
        $config = config('ticai');
        $url = '' ;
        if( !empty($tag) && isset($config[$tag]) && isset($config[$tag]['action']) ) {
            $url = "index/{$config[$tag]['action']}?".http_build_query($query) ;
        }
        return $url ;
    }

    public static function getCurrentTagUrl(){
        $tag = self::getReq()->get('tag','') ;
        $d = self::getReq()->get('d','') ;
        return self::getUrl($tag , ['tag' => $tag , 'd' => $d ]) ;
    }
    /**
     * @return Request
     */
    private static function getReq(){
        return app('request') ;
    }
}